UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9qtpb3p/nLx7kZsjsBSsp1SKdYgyN7Ru0aqxX5BQSpM='
WHERE
key_id = '7f400dc89b25cfaf15eca5bd5f593d65ac005587128b4527ce51e17967117c98'
AND (
token = '9qtpb3p/nLx7kZsjsBSsp1SKdYgyN7Ru0aqxX5BQSpM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)