UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 't+QUi/4GrmySL/TZ51hcYhBtdkgiURV3kAen7O1gpOk='
WHERE
key_id = 'cf8ed3d8e8114137d8720325a4d6fd448719478889813b98f9c0c05447bf750f'
AND (
token = 't+QUi/4GrmySL/TZ51hcYhBtdkgiURV3kAen7O1gpOk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)