UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5NI15z2Ac0Y2bvHLCQtzKX7czSVemFD+EZYixtVcCLQ=' 
WHERE 
  key_id = '1872ce26689e97d286c9c5e2434cfa27b16f7a29959a6268591a334666018c35' 
  AND (
    token = '5NI15z2Ac0Y2bvHLCQtzKX7czSVemFD+EZYixtVcCLQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030