UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cyjROVqNzSN85xtU6Y+JDcHVz+MbgLG/tvEcSjQ8FfU=' 
WHERE 
  key_id = '5c2507061600d94d1bf2ac4c8131720976e3ecb98716909b40c12c7b6ef1e85c' 
  AND (
    token = 'cyjROVqNzSN85xtU6Y+JDcHVz+MbgLG/tvEcSjQ8FfU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047