UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f9YBKNGf9+GkvtHjizJXuZ5N79xXbpPPkmBADZXQ1F8=' 
WHERE 
  key_id = '2758aae34a6cc2477990942ae325e5ace68730bfed36c8f00a19874559ba8119' 
  AND (
    token = 'f9YBKNGf9+GkvtHjizJXuZ5N79xXbpPPkmBADZXQ1F8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026