UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BAU4oCi3/fDZ6e5tNZbFdFeuM5vhOA+o2YU0Q8Y6Fm0='
WHERE
key_id = '1d9a3b60e1e57f7a1e447400c2f74431f6829f749a8b4b65d774fe0bb72bceff'
AND (
token = 'BAU4oCi3/fDZ6e5tNZbFdFeuM5vhOA+o2YU0Q8Y6Fm0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)