UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sNqglRfBW4tNregsFJYtKkqhrJ3p3PsU1lUuaPuwGL0=' 
WHERE 
  key_id = '582bd34bb020455b834d43f3971e5f21a004aa70040f76f5209ead0dd8c743e9' 
  AND (
    token = 'sNqglRfBW4tNregsFJYtKkqhrJ3p3PsU1lUuaPuwGL0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00079