UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PcwucKwJ+WMgLJXcsQP0Jm6s9VSWehqerK9x4e89sX0='
WHERE
key_id = 'f9a07b723bed3b0938053aa0e99ac4ae9880d44f4f2922fe3e4da69406842edf'
AND (
token = 'PcwucKwJ+WMgLJXcsQP0Jm6s9VSWehqerK9x4e89sX0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)