UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'C8YtJ8z7dP0sFD89m8saEUCH3XaQh4fFJyaO/EfJLww='
WHERE
key_id = '11ff87945dcd477624f2a9b482cbb7aa91ba93757bf2f25e9457327c4b8c4190'
AND (
token = 'C8YtJ8z7dP0sFD89m8saEUCH3XaQh4fFJyaO/EfJLww='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)