UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jW0yEzlmQ8rsgxEQYgUaO8k9GNhNArYozNr+lMpiaXQ='
WHERE
key_id = 'ba547b9b7bed04f4b8bb6ccf9406ebdd293d546738a0fbbbcb7a7f3da2d6ce6c'
AND (
token = 'jW0yEzlmQ8rsgxEQYgUaO8k9GNhNArYozNr+lMpiaXQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)