UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qqJHu3aC9BlW6Zeal+Mi+hGTduF7ouZQmc7NacUTXz4='
WHERE
key_id = 'cc870aa82bc03c08a570495401e5901260d492bb3809001a3636a64e7fc9168b'
AND (
token = 'qqJHu3aC9BlW6Zeal+Mi+hGTduF7ouZQmc7NacUTXz4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)