UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R2J5itDcwJfXN/B5nU82voxwF77ZY+LwFljACaapfsg=' 
WHERE 
  key_id = '3ac60028d6b4967e4cd9692a4386edba546613dd7e64131bb7dccd76877b5b45' 
  AND (
    token = 'R2J5itDcwJfXN/B5nU82voxwF77ZY+LwFljACaapfsg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036