UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uc118GRK2ayEwDszSuZxAZBCBieZCEq65gBv7ayZ6i4='
WHERE
key_id = 'b466daf40a82581dc53569b31df127b5900bf64eee425831a898a0cb3bb2fcb9'
AND (
token = 'uc118GRK2ayEwDszSuZxAZBCBieZCEq65gBv7ayZ6i4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)