UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p7ryNVFe/QHz+iHX4SC/FaL2s+k5zsRY1jlCcAeLlNU=' 
WHERE 
  key_id = '226843d28badcd3d7f80177c5e3ec38e73927938bbefc2307c2baf43483a1410' 
  AND (
    token = 'p7ryNVFe/QHz+iHX4SC/FaL2s+k5zsRY1jlCcAeLlNU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017