UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6gR9s87piZMhhXHabvNhzFt6kd/vmbFvVO4zwk81zD4='
WHERE
key_id = 'fcf2a262d8b023c1d01887cb5e7ba5d24cf00a579b3586844c262902c5d57c10'
AND (
token = '6gR9s87piZMhhXHabvNhzFt6kd/vmbFvVO4zwk81zD4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)