UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YAjliZ80H7eipoiqQgKvbpYTIp29hKXeYG1fZz0A08M=' 
WHERE 
  key_id = 'b2285e8b173f5155f7f1175fb999ced7fb32dcf9a78ff2d2ff531979b1a75d40' 
  AND (
    token = 'YAjliZ80H7eipoiqQgKvbpYTIp29hKXeYG1fZz0A08M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025