UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'T9Q3LyMIRk9Vtq1+eXgC9y/OrFx/eNsUU66E5giD2VY='
WHERE
key_id = 'd06293b7a7187d27cbfe6186d678e306ab7a11e303543b5e4554f43baaa75fe8'
AND (
token = 'T9Q3LyMIRk9Vtq1+eXgC9y/OrFx/eNsUU66E5giD2VY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)