UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Rs2MsD9A/ChJS7MFvtvAbcPbgov5UAskiJTIaRRJw18=' 
WHERE 
  key_id = 'aa79bfdd658c3923a2c22962fa2f10b4b3f9c49224f410d787578163caa841a7' 
  AND (
    token = 'Rs2MsD9A/ChJS7MFvtvAbcPbgov5UAskiJTIaRRJw18=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037