UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dygko9OcCLZbAVrveaC1VHWwkhAluLShFhltzCt1/Ew=' 
WHERE 
  key_id = '79232767176b2ca650cba9c99b1a2be9202dbb08b8b192c7101e96c1c032aea9' 
  AND (
    token = 'dygko9OcCLZbAVrveaC1VHWwkhAluLShFhltzCt1/Ew=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027