UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AvTJyjm/Dhw5xjHxOLMB8y/CSN4NlsPlbwpZ7+tCygk='
WHERE
key_id = '049409ace9cfde376e999833b294b2c874ad6f5c94daca55012d9cac439fae5b'
AND (
token = 'AvTJyjm/Dhw5xjHxOLMB8y/CSN4NlsPlbwpZ7+tCygk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)