UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oSK0/YyZC8nU68UreRK2HS2EH/eHXkgzM52U3mUfwKI='
WHERE
key_id = 'bca2736a49c5ee4fc6e9293d0fe424338be82b0112a6a365d08abb2281ced33d'
AND (
token = 'oSK0/YyZC8nU68UreRK2HS2EH/eHXkgzM52U3mUfwKI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)