UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'I+J0o7FMF7ee7PoSSHMHULsfvq3us+w7pv/eqoW+iZ0='
WHERE
key_id = 'd547400ae261e78deab0ce10eeb01207f49ba1028ab918577d93245ca0e56256'
AND (
token = 'I+J0o7FMF7ee7PoSSHMHULsfvq3us+w7pv/eqoW+iZ0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)