UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xbo+yZF5PE1+TsVGU6tvF40YWIASBR4KU8+shZUNrKA='
WHERE
key_id = '3ddd849be67c33b7f1b5c9345306b0abee4e117bb69577dfb025b5164b9f7dad'
AND (
token = 'xbo+yZF5PE1+TsVGU6tvF40YWIASBR4KU8+shZUNrKA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)