UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N2zuVRaWIdu5CTQdPHakP2bQ+aE2mlSoNGIFRwMMXac=' 
WHERE 
  key_id = 'ad31b97ca410f77729966ba0bed5e4d2dcb6b60c1d4d1e1086e3313f3dfe26dc' 
  AND (
    token = 'N2zuVRaWIdu5CTQdPHakP2bQ+aE2mlSoNGIFRwMMXac=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024