UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jNRjs2aJlXs9hlAKDhMckHzk5TjjACZzOdwA2yIkCXc=' 
WHERE 
  key_id = '2c2f5fe93df82a109b37b807d3cb47a2320243e65558c7715067f5788c507df3' 
  AND (
    token = 'jNRjs2aJlXs9hlAKDhMckHzk5TjjACZzOdwA2yIkCXc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031