UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'FX7tq2rRx6jG6fzNq6exImKws+Q+eWaccj/Bbnj8JKg='
WHERE
key_id = 'c3390fc4a7c0d4f1685145d8f1b303eaaa5510178a4dadeb938488a8bc549910'
AND (
token = 'FX7tq2rRx6jG6fzNq6exImKws+Q+eWaccj/Bbnj8JKg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)