UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KKUFhpAiFE99fcJf9Ixb2VuINEIsOOuWQiYuRUHrSHE='
WHERE
key_id = '2487a56d8fe43393da30cbb79e11f905bc1c79641ebe856f8f3a63903d1c9a5f'
AND (
token = 'KKUFhpAiFE99fcJf9Ixb2VuINEIsOOuWQiYuRUHrSHE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)