UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BMi4uBo7FsveAbI1WrWN9d1QE/u4W7S+CNKm9m6w68U='
WHERE
key_id = '7c538163b6da5ff70979b2484dd02ce6aa11afbc47a0e4c3e8c89a0c6883dac7'
AND (
token = 'BMi4uBo7FsveAbI1WrWN9d1QE/u4W7S+CNKm9m6w68U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)