UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bImTeWMVOWzfAQd/JTXEwYUAU4pNs7kPtFX/eViNNT8='
WHERE
key_id = 'de59c9fdcf0e78e2e83202dade8ac1cb08bc39397e619c9078846a611ad331df'
AND (
token = 'bImTeWMVOWzfAQd/JTXEwYUAU4pNs7kPtFX/eViNNT8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)