UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '08GLMbD/lmjeWp9aWXCU7RcHAnnNC7TYdN1YdgY0W8E='
WHERE
key_id = '50e1e97a102b2b82ae7326b8dda82d5ce23a82de55b782cd544e59063e52c40b'
AND (
token = '08GLMbD/lmjeWp9aWXCU7RcHAnnNC7TYdN1YdgY0W8E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)