UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MByn8w5KKBl67W0OksfbT+bsqpUkWFXGqJUSYw41l8M='
WHERE
key_id = 'b48ef20984c1ef3e5b64db0400efcc9c364a1881bb9165f7bfa882e6152d9ef0'
AND (
token = 'MByn8w5KKBl67W0OksfbT+bsqpUkWFXGqJUSYw41l8M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)