UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jUyVKySodhdM1yCO9c/jC1rpfsOopX89ZEkg+gjSVoE='
WHERE
key_id = 'c4b540d563b3782924045fbbf94a18cba22e6131fe3158a8f154ddf1b9eecdef'
AND (
token = 'jUyVKySodhdM1yCO9c/jC1rpfsOopX89ZEkg+gjSVoE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)