UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iHE24MKC8zXP7dIS9TUyMD33Jw4NuWpI2957ihQT5C8='
WHERE
key_id = 'baa1c1efafdfd8b1bbc77bf04e661d9bcb6de7b97b64253266b7a56d5486e5cf'
AND (
token = 'iHE24MKC8zXP7dIS9TUyMD33Jw4NuWpI2957ihQT5C8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)