UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vn7P2BEqFMYSGKSLmJly0oF7kD00ExAG3dXT1UOPooo=' 
WHERE 
  key_id = '81fd0fcd23179de59e11b953799b002ebcb50a6b4451f2c4a58c25bad812a0cf' 
  AND (
    token = 'vn7P2BEqFMYSGKSLmJly0oF7kD00ExAG3dXT1UOPooo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040