UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'joD7cQLOMsOOl5FJv4HW9lIHXfSo63JN/Sx9Jg1MWW0='
WHERE
key_id = 'c3dc1355528e507f9cc4fdfa120fb794e28cbc2b6d1a95db12f8dfe829131a78'
AND (
token = 'joD7cQLOMsOOl5FJv4HW9lIHXfSo63JN/Sx9Jg1MWW0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)