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

Query time 0.00056