UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'F1SoJplvBZkFOG1HWBzCHUgd6GIFSuEitfrM8taOqck=' 
WHERE 
  key_id = '6af3972d12149042f134155d4f4de7ab5a7d02766e66b770362a59a2f6bc4d2f' 
  AND (
    token = 'F1SoJplvBZkFOG1HWBzCHUgd6GIFSuEitfrM8taOqck=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024