UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NpJ1MTbQtamOuh6LBbGM23Aqap7PsFT3m/VHuMDUB8Y=' 
WHERE 
  key_id = '0383fae4cdd7c513cdb8197205863708faf42341b059508dc3958370d9407097' 
  AND (
    token = 'NpJ1MTbQtamOuh6LBbGM23Aqap7PsFT3m/VHuMDUB8Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036