UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YoLxTZdSOnJwiXYAwy1HbEP2tdgAUjL/+NwEYArLRLM=' 
WHERE 
  key_id = '6699a2a5dbf6e39bc85c092918c268481eee1a0d36b7084e89b1e4527a2e7991' 
  AND (
    token = 'YoLxTZdSOnJwiXYAwy1HbEP2tdgAUjL/+NwEYArLRLM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029